package com.hzhr.iot.device.service.helper;

import com.hzhr.iot.core.exception.ServiceException;
import com.hzhr.iot.device.model.iotDeviceType.IotDeviceTypeModel;
import com.hzhr.iot.device.service.IotDeviceTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;

@Component
public class IotDeviceTypeServiceHelper {
    @Autowired
    IotDeviceTypeService iotDeviceTypeService;

    public IotDeviceTypeModel getById(Map<String, String> header, int id)
            throws ServiceException {
        Map<String, Object> query = new HashMap<>();
        query.put("_show", "one");
        query.put("_show_info", true);
        query.put("_equal_id", id);
        IotDeviceTypeModel iotDeviceTypeModel = iotDeviceTypeService.get(header, query).getModel();
        return iotDeviceTypeModel;
    }
}
